-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add refactoring to replace ! with .Value #11227
Conversation
vsintegration/src/FSharp.Editor/Refactor/ChangeDerefToValueRefactoring.fs
Outdated
Show resolved
Hide resolved
@@ -46,6 +46,9 @@ type public FSharpParseFileResults = | |||
/// </summary> | |||
member TryRangeOfRefCellDereferenceContainingPos: expressionPos: pos -> range option | |||
|
|||
/// Gets the range of an expression being dereferenced. For `!expr`, gives the range of `expr` | |||
member TryRangeOfExpressionBeingDereferencedContainingPos: expressionPos: pos -> range option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more efficient approach is to unify this with TryRangeOfRefCellDereferenceContainingPos
. This would be a breaking change, but we're already doing several breaks in FCS 40.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice,
Thanks.
member _.VisitExpr(_, _, defaultTraverse, expr) = | ||
match expr with | ||
| SynExpr.App(_, false, SynExpr.Ident funcIdent, expr, _) -> | ||
if funcIdent.idText = "op_Dereference" && rangeContainsPos expr.Range expressionPos then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but perhaps we should consider an enum for id constants.
This should help with: fsharp/fslang-suggestions#569